<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- <script src="https://cdn.tailwindcss.com"></script> -->
    <!-- <script src="/tailwind/tailwind.css"></script> -->
    <script src="/tailwind/cdnjs/tailwind-3.4.16.js"></script>
    <!-- 开发环境版本，包含了有帮助的命令行警告 -->
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
</head>

<body>
    <div id="app">
        <ul id="example-1">
            <li v-for="item in items" :key="item.message">
                {{ item.message }}
            </li>
        </ul>
        <ul id="example-2">
            <li v-for="(item, index) in items">
                {{ parentMessage }} - {{ index }} - {{ item.message }}
            </li>
        </ul>
        <ul id="example-3">
            <li v-for="item of items">
                {{ parentMessage }} - {{ index }} - {{ item.message }}
            </li>
        </ul>
        <ul id="v-for-object" class="demo">
            <li v-for="value in object">
                {{ value }}
            </li>
            <h2>---</h2>
            <li v-for="(value, name) in object">
                {{ value }}-{{name}}
            </li>
            <h2>----</h2>
            <li v-for="(value, name, index) in object">
                {{ value }}-{{name}}-{{index}}
            </li>

            <div v-for="item in items" v-bind:key="item.id">
                {{item.id}}--{{item.message}}
            </div>
        </ul>

        <div id="app2">
            <ul>
                <li v-for="n in evenNumbers">{{ n }}</li>
                <li>----------</li>
                <li v-for="n in 5">{{ n }}</li>
                <li>----------</li>
                <li v-for="n in even">{{ n}}</li>
            </ul>
        </div>
        <div id="app3">
            <ul>
                <li v-for="todo in todos" v-if="!todo.isComplete" :key="todo.id">
                    {{ todo.text }}
                </li>
            </ul>
        </div>
    </div>
    <script>
        new Vue({
            el: '#app3',
            data: {
                todos: [
                    { id: 1, text: 'Learn JavaScript', isComplete: false },
                    { id: 2, text: 'Learn Vue.js', isComplete: true },
                    { id: 3, text: 'Build something awesome', isComplete: false },
                    { id: 4, text: 'Profit!', isComplete: true }
                ]
            }
        })
        new Vue({
            el: '#app2',
            data: {
                evenNumbers: [1, 2, 3],
                numbers: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
            },
            computed: {
                even: function () {
                    return this.numbers.filter(function (number) {
                        return number % 2 === 0
                    })
                }
            }
        })
        new Vue({
            el: '#v-for-object',
            data: {
                object: {
                    title: 'How to do lists in Vue',
                    author: 'Jane Doe',
                    publishedAt: '2016-04-10'
                },
                items: [
                    { id: 1, message: 'Foo' },
                    { id: 2, message: 'Bar' }
                ],
                parentMessage: 'Parent'
            }
        })

        var example1 = new Vue({
            el: '#example-1',
            data: {
                items: [
                    { message: 'Foo' },
                    { message: 'Bar' }
                ],
                parentMessage: 'Parent'
            }
        })
        var example1 = new Vue({
            el: '#example-2',
            data: {
                items: [
                    { message: 'Foo' },
                    { message: 'Bar' }
                ],
                parentMessage: 'Parent'
            }
        })
        var example1 = new Vue({
            el: '#example-3',
            data: {
                items: [
                    { message: 'Foo' },
                    { message: 'Bar' }
                ],
                parentMessage: 'Parent'
            }
        })
    </script>


</body>

</html>